Skip to content

Add new world special property (vehicle_engine_autostart) #4238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

samr46
Copy link
Contributor

@samr46 samr46 commented May 29, 2025

This property toggles automatic vehicle engine state behavior (true by default).

By default game turns on the engine automatically on driver enter and turns off the engine on driver exit for aircraft. This property allows us to disable this behavior and allow full control of vehicle engine state by using setVehicleEngineState.

In addition to disabling automatic engine state behavior I modified aircraft logic to allow rotors to spin without driver (if engine is on) and to prevent spinning if engine is off with driver inside. Existing hook is used to add additional changes to rotors state.
So this way the driver can leave helicopter with engine running. And it's possible to fly away instantly because rotors will keep spinning all the time while the engine is on.
At this moment we can achieve this kind of behavior using setVehicleRotorState and setVehicleRotorSpeed. This property works differently because it makes it based on the vehicle engine state instead of rotor state (which should be easier to use and more common).

setWorldSpecialPropertyEnabled("vehicle_engine_autostart", false)

Note

The game will not spin up rotors to maximum speed instantly if unoccupied helicopter with running engine just streamed in (like player teleporting to a location with helicopter that has engine on and no driver). It can be mitigated using setVehicleRotorSpeed if necessary although not really needed in most use cases.

Warning

To avoid possible engine state desynchronization between server and client it's recommended to use it on server side only with appropriate minclientversion (like some other existing world properties).

@Fernando-A-Rocha
Copy link
Contributor

I love this addition. It truly gives more control and freedom. Thank you!

@PlatinMTA
Copy link
Contributor

Ok I didn't know I needed this but I need this good job and thanks!

@tederis tederis added enhancement New feature or request feedback Further information is requested labels May 31, 2025
@samr46
Copy link
Contributor Author

samr46 commented Jun 1, 2025

I'm debating the property name. Maybe we should start naming properties in more readable format instead of keeping it consistent with existing properties? It's fine for short names but the more complex property names feel kind of unreadable.

In this case for example vehenginemanualmode could become vehicle_engine_manual_mode or VehicleEngineManualMode (the first alternative I think is the best one). Although manual mode could be confused with "manual transmission" (manual gearbox) so it's also debatable.

@Fernando-A-Rocha
Copy link
Contributor

How about vehenginestatecontrol ?

@tederis
Copy link
Member

tederis commented Jun 2, 2025

I would suggest vehicle_engine_autostart and make it true by default.

@samr46 samr46 changed the title Add new world special property (vehenginemanualmode) Add new world special property (vehicle_engine_autostart) Jun 2, 2025
Copy link
Member

@tederis tederis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the efforts.

@tederis tederis merged commit 8b3f344 into multitheftauto:master Jun 4, 2025
6 checks passed
MTABot pushed a commit that referenced this pull request Jun 4, 2025
8b3f344 Add new world special property (vehicle_engine_autostart) (#4238)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants